#include "../../common/commonbase.h"

namespace XIAOO{
    const int MAXBUFFER = 4096;

    class ServerNet{
        public:
            ServerNet();
            ~ServerNet();

        public:
            //main启动方法
            void startUp();
            //socket => create bind listen
            int initSocket();
            //阻塞到select
            void doSelect(int listenfd);
            //处理客户
            void clientHandle(int clientfd, char* buffer, int n);
            //处理下线的客户
            void offlineClientHandle(int cloendfd, fd_set *allset, int client[], int i);
        public:
            void test();

        private:
            void error(std::string errorMsg, int errorCode = 0);
    };
}